import request from '@/plugins/axios'
import qs from 'qs'
export default {
    //获取仓库列表（分页）
    getRepository(pageNow, pageShow) {
        return request({
            url: `/entrepot/entrepotList/${pageNow}/${pageShow}`,
            method: 'get'
        })
    },
    //更新仓库信息
    updateRepository(arr) {
        return request({
            url: `/entrepot/updatEntrepot`,
            method: 'post',
            data: qs.stringify({
                entrepotId: arr.entrepotId,
                entrepotName: arr.entrepotName,
                entrepotPort: arr.entrepotPort,
                entrepotAddress: arr.entrepotAddress
            })
        })
    },
    //新增仓库
    addRepository(arr) {
        return request({
            url: `/entrepot/saveEntrepot`,
            method: 'post',
            data: qs.stringify({
                entrepotName: arr.entrepotName,
                entrepotPort: arr.entrepotPort,
                entrepotAddress: arr.entrepotAddress
            })
        })
    },
    //删除仓库
    deleteRepository(id) {
        return request({
            url: `/entrepot/deleteEntrepot/${id}`,
            method: 'delete',
        })
    },
    //转移记录获取
    getTransfer(pageNow, pageShow) {
        return request({
            url: `/transfer/getAllTransfer/${pageNow}/${pageShow}`,
            method: 'get'
        })
    },
    //删除转移记录
    deleteTransfer(id) {
        return request({
            url: `/transfer/deleteTransferById/${id}`,
            method: 'delete',
        })
    },
    //获取库位记录
    getPosition() {
        return request({
            url: `/storage/getAllStorage`,
            method: 'get'
        })
    },
    //新增库位
    addPosition(arr) {
        return request({
            url: `/storage/saveStorage`,
            method: 'post',
            data: {
                current: arr.current,
                max: arr.max,
                entrepotName: arr.entrepotName,
                storageName: arr.storageName,
                materialId: arr.materialId
            }
        })
    },
    //删除库位
    deletePosition(id) {
        return request({
            url: `/storage/deleteStorage/${id}`,
            method: 'delete',
        })
    },
    //请求库位二维码
    getQRCode(id) {
        return request({
            url: `/storage/getRrCode/${id}`,
            method: 'get',
        })
    },
    //获取物料信息
    getMaterial(now,size){
        return request({
            url: `/material/materialFindList/${now}/${size}`,
            method: 'get',
        })
    },
}